package com.itheima.text4;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class TCPServer {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10004);
        Socket accept = ss.accept();
        BufferedReader br = new BufferedReader(new
                InputStreamReader(accept.getInputStream()));

        //获取地址
        String ip = ss.getInetAddress().getHostAddress();
        String line;

        while ((line = br.readLine()) != null) {

            System.out.println(ip + "---" + line);
        }

        ss.close();
    }
}